package net.xiduth.game.player.dialogues.auto;

import net.xiduth.game.player.dialogues.Dialogue;

/**
 * 
 * @author Oracle
 * 
 * Handles PvM Rewards and info.
 *
 */
public class Page4PvM extends Dialogue {


	@Override
	public void start() {
		sendOptionsDialogue("PvM Rewards - Page 4", "Cannon base (3500 pts.)", "Cannon stand (2500 pts.)", "Cannon barrels (2500 pts.)" , "Cannon furnace (2500 pts.)", "Next page...");
		stage = 4;
	}

	@Override
	public void run(int interfaceId, int option) {
		switch(stage) {
		case 3:
			end();
			break;
		case 4:
			switch(option) {
		case OPTION_1:
				if (player.getPvMPoints() >= 3500) {
				player.getBank().addItem(6, 1, true);
				player.setPvMPoints(player.getPvMPoints()
						- 3500);
				player.getInterfaceManager().closeChatBoxInterface();
				player.getInterfaceManager().sendChatBoxInterface(1189);
				player.getPackets().sendItemOnIComponent(1189, 1, 6, 1);
				player.getPackets().sendIComponentText(1189, 4, "The item has been added to your bank.");
				stage = 3;
				}else{
				sendDialogue("You need 3500 points to buy this item." );
				stage = 3;
				}
				break;
		case OPTION_2:
			if (player.getPvMPoints() >= 2500) {
			player.getBank().addItem(8, 1, true);
			player.setPvMPoints(player.getPvMPoints()
					- 2500);
			player.getInterfaceManager().closeChatBoxInterface();
			player.getInterfaceManager().sendChatBoxInterface(1189);
			player.getPackets().sendItemOnIComponent(1189, 1, 8, 1);
			player.getPackets().sendIComponentText(1189, 4, "The items have been added to your bank.");
			stage = 3;
			}else{
			sendDialogue("You need 2500 points to buy this item." );
			stage = 3;
			}
			break;
		case OPTION_3:
			if (player.getPvMPoints() >= 2500) {
			player.getBank().addItem(10, 1, true);
			player.setPvMPoints(player.getPvMPoints()
					- 2500);
			player.getInterfaceManager().closeChatBoxInterface();
			player.getInterfaceManager().sendChatBoxInterface(1189);
			player.getPackets().sendItemOnIComponent(1189, 1, 10, 1);
			player.getPackets().sendIComponentText(1189, 4, "The items have been added to your bank.");
			stage = 3;
			}else{
			sendDialogue("You need 2500 points to buy this item." );
			stage = 3;
			}
			break;
		case OPTION_4:
			if (player.getPvMPoints() >= 2500) {
				player.getBank().addItem(12, 1, true);
				player.setPvMPoints(player.getPvMPoints()
						- 2500);
				player.getInterfaceManager().closeChatBoxInterface();
				player.getInterfaceManager().sendChatBoxInterface(1189);
				player.getPackets().sendItemOnIComponent(1189, 1, 12, 1);
				player.getPackets().sendIComponentText(1189, 4, "The items have been added to your bank.");
			stage = 3;
			}else{
			sendDialogue("You need 2500 points to buy this." );
			stage = 3;
			}
			break;
		case OPTION_5:
			player.getDialogueManager().startDialogue("Page5PvM");
			break;
		default:
			end();
			break;
		}}}

	@Override
	public void finish() {

	}

}
